﻿using liaowa2.Api;
using liaowa2.Api.App_Start;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OAuth;
using Owin;
using System;

[assembly: OwinStartup(typeof(Startup))]
namespace liaowa2.Api
{
    /// <summary>
    /// 
    /// </summary>
    public class Startup
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="app"></param>
        public void Configuration(IAppBuilder app)
        {
            app.UseOAuthBearerTokens(new OAuthAuthorizationServerOptions
            {
                TokenEndpointPath = new PathString("/oauth2/token"),
                Provider = new OpenAuthorizationServerProvider(),
                //RefreshTokenProvider = TimeSpan.FromMinutes(2),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
                AuthenticationMode = AuthenticationMode.Active,
                AllowInsecureHttp = true
            });
        }
    }
}